import Vue from 'vue'
import VueRouter from 'vue-router'

import Book from '@/views/book'
import Borrow from '@/views/borrow'
import Category from '@/views/category'
import ExceptionLog from '@/views/exceptionLog'
import Login from '@/views/login'
import OperateLog from '@/views/operateLog'
import User from '@/views/user'
import Layout from '@/views/layout'
import Back from '@/views/back'
import Upload from '@/views/user/upload'

Vue.use(VueRouter)

const router = new VueRouter({
  // mode: history,
  routes: [
    {
      path: '/upload',
      component: Upload
    },
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/layout',
      component: Layout,
      redirect: '/book',
      children: [
        { path: '/book', component: Book },
        { path: '/borrow', component: Borrow },
        { path: '/category', component: Category },
        { path: '/exceptionLog', component: ExceptionLog },
        { path: '/operateLog', component: OperateLog },
        { path: '/user', component: User },
        { path: '/back', component: Back }
      ]
    },
    { path: '/login', component: Login }
  ]
})

export default router
